/*
 * Copyright (C) 2009 Leandro de Oliveira Aparecido <lehphyro@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.code.japa.annotation;

/**
 * Fetch strategies of collections representing entity extents.
 * 
 * @author Leandro Aparecido
 * @since 1.0
 * @see com.google.code.japa.repository.collection.jpa.FetchAllJpaPersistentCollectionStrategy
 * @see com.google.code.japa.repository.collection.jpa.FetchBufferedJpaPersistentCollectionStrategy
 * @see com.google.code.japa.repository.collection.jpa.FetchOnDemandJpaPersistentCollectionStrategy
 */
public enum FetchStrategy {
	/**
	 * Fetch all instances of the entity when loading.
	 */
	ALL,
	
	/**
	 * Fetch only requested instances. Keep a buffer of entities, if the buffer is exhausted, fetch
	 * sequentially to fill it discarding the entities on the top of the buffer.
	 */
	BUFFERED,
	
	/**
	 * Fetch only requested instances. Executes a JPA query for each requested entity.
	 * All requested entities are kept in memory for the lifetime of the collection.
	 */
	ONDEMAND,
	;
}
